import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { getweather } from '../request/index'

export const useCounterStore = defineStore('counter', () => {
  const count = ref(0)
  let tiandata = ref({})
  const doubleCount = computed(() => count.value * 2)
  function increment() {
    count.value++
  }
  //天气
  function gettainqi() {
    getweather().then(res => {
      console.log(res);
      tiandata.value = res.data
    })
  }

  return { count, doubleCount, increment, gettainqi, tiandata }
}, {
  persist: true,
})
